from selenium import webdriver
import time

driver = webdriver.Chrome()

driver.get(
    "file:///C:/zhaoqiang.vendor/%E6%A1%8C%E9%9D%A2/%E5%8D%95%E9%80%89%E4%B8%8E%E5%A4%8D%E9%80%89.html"
)
time.sleep(1)
"""
单选框的操作
"""
male_element = driver.find_element("id", "as")
female_element = driver.find_element("id", "sd")
if not female_element.is_selected():
    female_element.click()
else:
    print("已经提前选好了，不用重复选择")

# --------------------------------------------------------------------------------
"""
复选框的操作
"""
elements = driver.find_elements("name", "c")
for el in elements:
    if not el.is_selected():
        time.sleep(2)
        el.click()
        print("小主，已经选好了哦~")
    else:
        print("小主，已经选过了，不用在选了哦~")

time.sleep(1)
driver.close()
